package com.wf.controller;


import com.wf.dao.ESPojo.ESArticle;
import com.wf.service.ArticleEsService;
import com.wf.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.websocket.server.PathParam;
import java.io.IOException;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/search")
public class SearchController {

    @Resource
    private ArticleEsService articleEsService;

    @PostMapping()
    public Result search(@PathParam("keyWord") String keyWord) throws IOException {
        List<ESArticle> esArticles = articleEsService.searchByKeyword(keyWord);
        return Result.success(esArticles);
    }

}
